<template>
  <div>
    <!-- <button @click="gotoCity">北京</button> -->
    <!-- 声明式导航 -->
    <router-link to="/citylist" tag="p">{{ name }}</router-link>
  </div>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {
      name: "北京",
    };
  },
  methods: {
    gotoCity() {
      //跳转  编程式导航 push() replace() go()
      this.$router.push("/citylist");
    },
  },
  created() {
    this.name = this.$route.query.cityName;
  },
};
</script>

<style>
</style>